Skip to content

fix(rust): normalize custom Redis server errors - #278

Draft
lan17 wants to merge 1 commit into
mainfrom
fix/rust-custom-redis-error-normalization
Draft

lan17 wants to merge 1 commit into
mainfrom
fix/rust-custom-redis-error-normalization

Conversation

@lan17

@lan17 lan17 commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Problem

A local reproduction with a raw RedisConnection wrapper showed that a server error returned as Ok(Value::ServerError) bypassed invalidation recovery. With an empty script cache, NOSCRIPT became a protocol error instead of triggering the existing EVAL fallback. Other server errors also lost their native error type and code.

Change

Bug fix: normalize server-error values at the RedisAdapter boundary before reply validation or invalidation retry. The public trait documentation now states that both Redis error representations are accepted.

The existing built-in connection behavior, one-retry policy, command arguments, cancellation, and connection ownership are unchanged. Native unit tests cover error preservation; raw-wrapper integration tests cover cold scripts and SCRIPT FLUSH with RESP2 and RESP3.

No design record is needed. This restores native adapter behavior without changing a portable contract or public construction API. Native error representations and client retry APIs remain binding and integration concerns under B01/B02/E01/X02; no new Quint regression is needed.

Ports

Port Status
TypeScript N/A: Rust Redis reply representation only
Go N/A: Rust Redis reply representation only
Rust Fixed with native and real-server regressions
Python N/A: Rust Redis reply representation only

Validation

Head: fb5cf51fb14cb2d355fe09805acf05a2a9ebf204

The local checks below apply to the unchanged source tree after a commit-message-only update.

  • Before the fix, on base 22c1f502ddb5f27419faf5caa528d9ea3a9c92e4 with the new tests: two adapter unit regressions and both RESP2/RESP3 custom-connection tests failed.
  • cargo test --locked --features redis --lib redis::tests::: 13 passed.
  • cargo test --locked --features redis --test redis_integration redis_custom_connection -- --ignored: both protocol tests passed.
  • make check-rust: passed, including formatting, both clippy checks, native tests, and smoke conformance.
  • make integration-rust: all 7 tests passed across Redis, Valkey, Cluster, cross-language interoperability, and the new custom-connection cases.
  • make audit: passed.
  • git diff --check: passed.
  • Hosted PR checks: passed on fb5cf51fb14cb2d355fe09805acf05a2a9ebf204, including the required test check (CI run).
  • Required Replay run: passed on fb5cf51fb14cb2d355fe09805acf05a2a9ebf204 after green PR CI. Generation, symbolic checks, all four port replays, and the aggregate completed successfully.

Not run: none of the required validation lanes. The mutation tier is not required because neither changed source file is named by the mutation catalogs. This pull request remains draft for maintainer review.

Follow-ups

None.

@codecov-commenter

codecov-commenter commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.78%. Comparing base (22c1f50) to head (fb5cf51).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #278      +/-   ##
==========================================
+ Coverage   94.76%   94.78%   +0.01%     
==========================================
  Files          84       84              
  Lines       13168    13208      +40     
  Branches      805      805              
==========================================
+ Hits        12479    12519      +40     
  Misses        623      623              
  Partials       66       66              
Flag Coverage Δ
go 93.86% <ø> (ø)
python 93.60% <ø> (ø)
rust 94.81% <100.00%> (+0.02%) ⬆️
typescript 97.21% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Normalize server-error values before classifying adapter replies or retrying invalidation. Cover raw custom connections with cold-script and flushed-script tests in RESP2 and RESP3.
@lan17
lan17 force-pushed the fix/rust-custom-redis-error-normalization branch from 297e7d1 to fb5cf51 Compare November 13, 2026 07:23

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants